﻿using Decoration.IRepository;
using Decoration.IService;
using Decoration.Models.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Decoration.Service
{
    public class UserRoleService:BaseService<Base_UserRole>,IUserRoleService
    {
        IUserRoleRepository _rep;
        IBaseQueryRepository svc;

        public UserRoleService(IUserRoleRepository _rep,IBaseQueryRepository svc):base(_rep,svc) 
        { 
            this._rep = _rep;
        }

        public bool Delete(List<Base_UserRole> list, bool isSave = true)
        {
            foreach (var item in list) 
            {
                _rep.Delete(item);
            }
            if (isSave)
            {
                return SaveChanges();
            }
            else
            {
                return false;
            }
        }
        public bool Add(List<Base_UserRole> list, bool isSave = true)
        {
            foreach (var item in list)
            {
                _rep.Add(item);
            }
            if (isSave)
            {
                return SaveChanges();
            }
            else
            {
                return false;
            }
        }
    }
}
